{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 气泡图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1096\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1096\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1096\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1096\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1096\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure,show,output_notebook\n",
    "output_notebook()\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"ad03149e-b843-49b8-bc35-3e1acd6f876a\" data-root-id=\"1097\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"57b031f3-9d51-446b-a555-6075a6d482ab\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1108\"}],\"center\":[{\"id\":\"1111\"},{\"id\":\"1115\"}],\"left\":[{\"id\":\"1112\"}],\"renderers\":[{\"id\":\"1133\"}],\"title\":{\"id\":\"1098\"},\"toolbar\":{\"id\":\"1123\"},\"x_range\":{\"id\":\"1100\"},\"x_scale\":{\"id\":\"1104\"},\"y_range\":{\"id\":\"1102\"},\"y_scale\":{\"id\":\"1106\"}},\"id\":\"1097\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"formatter\":{\"id\":\"1144\"},\"ticker\":{\"id\":\"1113\"}},\"id\":\"1112\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1112\"},\"dimension\":1,\"ticker\":null},\"id\":\"1115\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"1130\"},\"glyph\":{\"id\":\"1131\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1132\"},\"selection_glyph\":null,\"view\":{\"id\":\"1134\"}},\"id\":\"1133\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1144\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"text\":\"bubble chart\"},\"id\":\"1098\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1102\",\"type\":\"DataRange1d\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1116\"},{\"id\":\"1117\"},{\"id\":\"1118\"},{\"id\":\"1119\"},{\"id\":\"1120\"},{\"id\":\"1121\"}]},\"id\":\"1123\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1149\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1119\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"navy\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1132\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1100\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1104\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1113\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1108\"},\"ticker\":null},\"id\":\"1111\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1116\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1146\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1109\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1122\"}},\"id\":\"1118\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1106\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1117\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data\":{\"size\":{\"__ndarray__\":\"BQAAAAoAAAAPAAAAFAAAAA==\",\"dtype\":\"int32\",\"order\":\"little\",\"shape\":[4]},\"x\":[1,2,3,4],\"y\":[1,2,3,4]},\"selected\":{\"id\":\"1149\"},\"selection_policy\":{\"id\":\"1150\"}},\"id\":\"1130\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"formatter\":{\"id\":\"1146\"},\"ticker\":{\"id\":\"1109\"}},\"id\":\"1108\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_color\":{\"value\":\"navy\"},\"line_color\":{\"value\":\"navy\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1131\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1150\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"1130\"}},\"id\":\"1134\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1122\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1120\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1121\",\"type\":\"HelpTool\"}],\"root_ids\":[\"1097\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"57b031f3-9d51-446b-a555-6075a6d482ab\",\"root_ids\":[\"1097\"],\"roots\":{\"1097\":\"ad03149e-b843-49b8-bc35-3e1acd6f876a\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1097"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=[1,2,3,4]\n",
    "y=[1,2,3,4]\n",
    "sizes=np.array(y)*5 #气泡大小\n",
    "p=figure(title='bubble chart')\n",
    "p.scatter(x,y,marker='circle',size=sizes,color='navy'),\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using data directory: C:\\Users\\pc\\.bokeh\\data\n",
      "Skipping 'CGM.csv' (checksum match)\n",
      "Skipping 'US_Counties.zip' (checksum match)\n",
      "Skipping 'us_cities.json' (checksum match)\n",
      "Skipping 'unemployment09.csv' (checksum match)\n",
      "Skipping 'AAPL.csv' (checksum match)\n",
      "Skipping 'FB.csv' (checksum match)\n",
      "Skipping 'GOOG.csv' (checksum match)\n",
      "Skipping 'IBM.csv' (checksum match)\n",
      "Skipping 'MSFT.csv' (checksum match)\n",
      "Skipping 'WPP2012_SA_DB03_POPULATION_QUINQUENNIAL.zip' (checksum match)\n",
      "Skipping 'gapminder_fertility.csv' (checksum match)\n",
      "Skipping 'gapminder_population.csv' (checksum match)\n",
      "Skipping 'gapminder_life_expectancy.csv' (checksum match)\n",
      "Skipping 'gapminder_regions.csv' (checksum match)\n",
      "Skipping 'world_cities.zip' (checksum match)\n",
      "Skipping 'airports.json' (checksum match)\n",
      "Skipping 'movies.db.zip' (checksum match)\n",
      "Skipping 'airports.csv' (checksum match)\n",
      "Skipping 'routes.csv' (checksum match)\n",
      "Skipping 'haarcascade_frontalface_default.xml' (checksum match)\n"
     ]
    }
   ],
   "source": [
    "import bokeh\n",
    "bokeh.sampledata.download()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from bokeh.embed import file_html\n",
    "from bokeh.io import output_notebook,show\n",
    "from bokeh.layouts import layout\n",
    "from bokeh.models import(\n",
    "    ColumnDataSource, Plot, Circle, Range1d, LinearAxis, HoverTool, \n",
    "    Text, SingleIntervalTicker, Slider, CustomJS, Legend, LegendItem, CategoricalColorMapper)\n",
    "from bokeh.palettes import Spectral6\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [],
   "source": [
    "def process_data():\n",
    "    from bokeh.sampledata.gapminder import fertility, life_expectancy, population, regions\n",
    "\n",
    "    # Make the column names ints not strings for handling\n",
    "    columns = list(fertility.columns)\n",
    "    years = list(range(int(columns[0]), int(columns[-1])))\n",
    "    rename_dict = dict(zip(columns, years))\n",
    "\n",
    "    fertility = fertility.rename(columns=rename_dict)\n",
    "    life_expectancy = life_expectancy.rename(columns=rename_dict)\n",
    "    population = population.rename(columns=rename_dict)\n",
    "    regions = regions.rename(columns=rename_dict)\n",
    "    regions_list = list(regions.Group.unique())\n",
    "\n",
    "    # Turn population into bubble sizes. Use min_size and factor to tweak.\n",
    "    scale_factor = 200\n",
    "    population_size = np.sqrt(population / np.pi) / scale_factor\n",
    "    min_size = 3\n",
    "    population_size = population_size.where(population_size >= min_size).fillna(min_size)\n",
    "\n",
    "    return fertility, life_expectancy, population_size, regions, years, regions_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(                        1964   1965   1966   1967   1968   1969   1970   1971  \\\n",
       " Country                                                                         \n",
       " Afghanistan            7.671  7.671  7.671  7.671  7.671  7.671  7.671  7.671   \n",
       " Albania                5.711  5.594  5.483  5.376  5.268  5.160  5.050  4.933   \n",
       " Algeria                7.653  7.655  7.657  7.658  7.657  7.652  7.641  7.622   \n",
       " American Samoa           NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN   \n",
       " Andorra                  NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN   \n",
       " ...                      ...    ...    ...    ...    ...    ...    ...    ...   \n",
       " Virgin Islands (U.S.)  5.698  5.679  5.634  5.561  5.459  5.328  5.167  4.976   \n",
       " Yemen, Rep.            7.385  7.418  7.447  7.471  7.491  7.512  7.542  7.593   \n",
       " Zambia                 7.240  7.292  7.338  7.376  7.405  7.425  7.437  7.443   \n",
       " Zimbabwe               7.347  7.373  7.391  7.403  7.411  7.415  7.417  7.419   \n",
       " Åland                    NaN    NaN    NaN    NaN    NaN    NaN    NaN    NaN   \n",
       " \n",
       "                         1972   1973  ...   2004   2005   2006   2007   2008  \\\n",
       " Country                              ...                                      \n",
       " Afghanistan            7.671  7.671  ...  7.136  6.930  6.702  6.456  6.196   \n",
       " Albania                4.809  4.677  ...  2.004  1.919  1.849  1.796  1.761   \n",
       " Algeria                7.591  7.548  ...  2.448  2.507  2.580  2.656  2.725   \n",
       " American Samoa           NaN    NaN  ...    NaN    NaN    NaN    NaN    NaN   \n",
       " Andorra                  NaN    NaN  ...    NaN    NaN    NaN    NaN    NaN   \n",
       " ...                      ...    ...  ...    ...    ...    ...    ...    ...   \n",
       " Virgin Islands (U.S.)  4.760  4.527  ...  2.219  2.278  2.337  2.391  2.438   \n",
       " Yemen, Rep.            7.672  7.782  ...  5.588  5.393  5.199  5.010  4.829   \n",
       " Zambia                 7.446  7.447  ...  5.974  5.954  5.932  5.908  5.881   \n",
       " Zimbabwe               7.420  7.417  ...  3.987  3.969  3.941  3.903  3.853   \n",
       " Åland                    NaN    NaN  ...    NaN    NaN    NaN    NaN    NaN   \n",
       " \n",
       "                         2009   2010   2011   2012   2013  \n",
       " Country                                                   \n",
       " Afghanistan            5.928  5.659  5.395  5.141  4.900  \n",
       " Albania                1.744  1.741  1.748  1.760  1.771  \n",
       " Algeria                2.781  2.817  2.829  2.820  2.795  \n",
       " American Samoa           NaN    NaN    NaN    NaN    NaN  \n",
       " Andorra                  NaN    NaN    NaN    NaN    NaN  \n",
       " ...                      ...    ...    ...    ...    ...  \n",
       " Virgin Islands (U.S.)  2.472  2.493  2.501  2.497  2.487  \n",
       " Yemen, Rep.            4.658  4.498  4.348  4.207  4.075  \n",
       " Zambia                 5.849  5.813  5.773  5.731  5.687  \n",
       " Zimbabwe               3.792  3.721  3.643  3.564  3.486  \n",
       " Åland                    NaN    NaN    NaN    NaN    NaN  \n",
       " \n",
       " [244 rows x 50 columns],\n",
       "                          1964    1965    1966    1967    1968    1969    1970  \\\n",
       " Country                                                                         \n",
       " Afghanistan            33.639  34.152  34.662  35.170  35.674  36.172  36.663   \n",
       " Albania                65.475  65.863  66.122  66.316  66.500  66.702  66.948   \n",
       " Algeria                47.953  48.389  48.806  49.205  49.592  49.976  50.366   \n",
       " American Samoa            NaN     NaN     NaN     NaN     NaN     NaN     NaN   \n",
       " Andorra                   NaN     NaN     NaN     NaN     NaN     NaN     NaN   \n",
       " ...                       ...     ...     ...     ...     ...     ...     ...   \n",
       " Virgin Islands (U.S.)  65.198  65.597  66.015  66.442  66.867  67.290  67.708   \n",
       " Yemen, Rep.            36.068  36.957  37.827  38.679  39.516  40.346  41.176   \n",
       " Zambia                 46.574  46.929  47.303  47.704  48.131  48.580  49.044   \n",
       " Zimbabwe               52.993  53.325  53.648  53.965  54.279  54.596  54.918   \n",
       " Åland                     NaN     NaN     NaN     NaN     NaN     NaN     NaN   \n",
       " \n",
       "                          1971    1972    1973  ...    2004    2005    2006  \\\n",
       " Country                                        ...                           \n",
       " Afghanistan            37.143  37.614  38.075  ...  56.583  57.071  57.582   \n",
       " Albania                67.251  67.595  67.966  ...  75.725  75.949  76.124   \n",
       " Algeria                50.767  51.195  51.670  ...  69.682  69.854  70.020   \n",
       " American Samoa            NaN     NaN     NaN  ...     NaN     NaN     NaN   \n",
       " Andorra                   NaN     NaN     NaN  ...     NaN     NaN     NaN   \n",
       " ...                       ...     ...     ...  ...     ...     ...     ...   \n",
       " Virgin Islands (U.S.)  68.122  68.534  68.942  ...  78.358  78.522  78.688   \n",
       " Yemen, Rep.            42.017  42.878  43.763  ...  61.307  61.520  61.728   \n",
       " Zambia                 49.513  49.970  50.392  ...  45.791  47.156  48.613   \n",
       " Zimbabwe               55.247  55.586  55.940  ...  43.244  43.958  45.157   \n",
       " Åland                     NaN     NaN     NaN  ...  79.880  80.000  80.100   \n",
       " \n",
       "                          2007    2008    2009    2010    2011    2012    2013  \n",
       " Country                                                                        \n",
       " Afghanistan            58.102  58.618  59.124  59.612  60.079  60.524  60.947  \n",
       " Albania                76.278  76.433  76.598  76.780  76.979  77.185  77.392  \n",
       " Algeria                70.180  70.332  70.477  70.615  70.747  70.874  71.000  \n",
       " American Samoa            NaN     NaN     NaN     NaN     NaN     NaN     NaN  \n",
       " Andorra                   NaN     NaN     NaN     NaN     NaN     NaN     NaN  \n",
       " ...                       ...     ...     ...     ...     ...     ...     ...  \n",
       " Virgin Islands (U.S.)  78.861  79.047  79.247  79.463  79.690  79.922  80.152  \n",
       " Yemen, Rep.            61.933  62.136  62.337  62.536  62.731  62.923  63.112  \n",
       " Zambia                 50.126  51.648  53.137  54.549  55.851  57.037  58.105  \n",
       " Zimbabwe               46.827  48.890  51.234  53.684  56.040  58.142  59.871  \n",
       " Åland                     NaN     NaN     NaN     NaN     NaN     NaN     NaN  \n",
       " \n",
       " [244 rows x 50 columns],\n",
       "                            1964      1965      1966       1967       1968  \\\n",
       " Country                                                                     \n",
       " Afghanistan            9.129985  9.226692  9.325238   9.425367   9.529220   \n",
       " Albania                3.802632  3.857528  3.911866   3.965554   4.018553   \n",
       " Algeria                9.630513  9.740649  9.865195  10.002490  10.149715   \n",
       " American Samoa         3.000000  3.000000  3.000000   3.000000   3.000000   \n",
       " Andorra                3.000000  3.000000  3.000000   3.000000   3.000000   \n",
       " ...                         ...       ...       ...        ...        ...   \n",
       " Virgin Islands (U.S.)  3.000000  3.000000  3.000000   3.000000   3.000000   \n",
       " Yemen, Rep.            6.632319  6.694750  6.756744   6.818802   6.879700   \n",
       " Zambia                 5.225038  5.305531  5.387545   5.471262   5.557277   \n",
       " Zimbabwe               5.835698  5.932103  6.029354   6.127726   6.227873   \n",
       " Åland                  3.000000  3.000000  3.000000   3.000000   3.000000   \n",
       " \n",
       "                             1969       1970       1971       1972       1973  \\\n",
       " Country                                                                        \n",
       " Afghanistan             9.639633   9.757751   9.882623  10.010863  10.137962   \n",
       " Albania                 4.070848   4.122445   4.173335   4.223538   4.273134   \n",
       " Algeria                10.302802  10.458904  10.617371  10.779070  10.944540   \n",
       " American Samoa          3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " Andorra                 3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " ...                          ...        ...        ...        ...        ...   \n",
       " Virgin Islands (U.S.)   3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " Yemen, Rep.             6.937871   6.992874   7.044051   7.093649   7.147630   \n",
       " Zambia                  5.646365   5.738974   5.835247   5.934780   6.036802   \n",
       " Zimbabwe                6.330652   6.436603   6.546321   6.659561   6.775087   \n",
       " Åland                   3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " \n",
       "                        ...       2004       2005       2006       2007  \\\n",
       " Country                ...                                               \n",
       " Afghanistan            ...  14.574636  14.823999  15.038847  15.229420   \n",
       " Albania                ...   4.986668   5.000165   5.011934   5.022290   \n",
       " Algeria                ...  16.056138  16.177700  16.301065  16.426204   \n",
       " American Samoa         ...   3.000000   3.000000   3.000000   3.000000   \n",
       " Andorra                ...   3.000000   3.000000   3.000000   3.000000   \n",
       " ...                    ...        ...        ...        ...        ...   \n",
       " Virgin Islands (U.S.)  ...   3.000000   3.000000   3.000000   3.000000   \n",
       " Yemen, Rep.            ...  12.623897  12.818607  13.015571  13.215468   \n",
       " Zambia                 ...   9.437503   9.550634   9.669765   9.794575   \n",
       " Zimbabwe               ...  10.012528  10.001717   9.985381   9.966072   \n",
       " Åland                  ...   3.000000   3.000000   3.000000   3.000000   \n",
       " \n",
       "                             2008       2009       2010       2011       2012  \\\n",
       " Country                                                                        \n",
       " Afghanistan            15.409709  15.599040  15.810335  16.046771  16.302311   \n",
       " Albania                 5.031576   5.040524   5.049642   5.058856   5.067802   \n",
       " Algeria                16.552025  16.677068  16.800209  16.921031  17.039513   \n",
       " American Samoa          3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " Andorra                 3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " ...                          ...        ...        ...        ...        ...   \n",
       " Virgin Islands (U.S.)   3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " Yemen, Rep.            13.418522  13.624978  13.834877  14.048173  14.264422   \n",
       " Zambia                  9.925413  10.062423  10.205662  10.355207  10.511042   \n",
       " Zimbabwe                9.954207   9.963176  10.002022  10.074528  10.176422   \n",
       " Åland                   3.000000   3.000000   3.000000   3.000000   3.000000   \n",
       " \n",
       "                             2013  \n",
       " Country                           \n",
       " Afghanistan            16.569297  \n",
       " Albania                 5.076387  \n",
       " Algeria                17.155428  \n",
       " American Samoa          3.000000  \n",
       " Andorra                 3.000000  \n",
       " ...                          ...  \n",
       " Virgin Islands (U.S.)   3.000000  \n",
       " Yemen, Rep.            14.482764  \n",
       " Zambia                 10.672923  \n",
       " Zimbabwe               10.298556  \n",
       " Åland                   3.000000  \n",
       " \n",
       " [244 rows x 50 columns],\n",
       "                                             Group  ID\n",
       " Country                                              \n",
       " Angola                         Sub-Saharan Africa  AO\n",
       " Benin                          Sub-Saharan Africa  BJ\n",
       " Botswana                       Sub-Saharan Africa  BW\n",
       " Burkina Faso                   Sub-Saharan Africa  BF\n",
       " Burundi                        Sub-Saharan Africa  BI\n",
       " ...                                           ...  ..\n",
       " Venezuela                                 America  VE\n",
       " Western Sahara         Middle East & North Africa  EH\n",
       " Vietnam                       East Asia & Pacific  VN\n",
       " Virgin Islands (U.S.)                     America  VI\n",
       " Vanuatu                       East Asia & Pacific  VU\n",
       " \n",
       " [244 rows x 2 columns],\n",
       " [1964,\n",
       "  1965,\n",
       "  1966,\n",
       "  1967,\n",
       "  1968,\n",
       "  1969,\n",
       "  1970,\n",
       "  1971,\n",
       "  1972,\n",
       "  1973,\n",
       "  1974,\n",
       "  1975,\n",
       "  1976,\n",
       "  1977,\n",
       "  1978,\n",
       "  1979,\n",
       "  1980,\n",
       "  1981,\n",
       "  1982,\n",
       "  1983,\n",
       "  1984,\n",
       "  1985,\n",
       "  1986,\n",
       "  1987,\n",
       "  1988,\n",
       "  1989,\n",
       "  1990,\n",
       "  1991,\n",
       "  1992,\n",
       "  1993,\n",
       "  1994,\n",
       "  1995,\n",
       "  1996,\n",
       "  1997,\n",
       "  1998,\n",
       "  1999,\n",
       "  2000,\n",
       "  2001,\n",
       "  2002,\n",
       "  2003,\n",
       "  2004,\n",
       "  2005,\n",
       "  2006,\n",
       "  2007,\n",
       "  2008,\n",
       "  2009,\n",
       "  2010,\n",
       "  2011,\n",
       "  2012],\n",
       " ['Sub-Saharan Africa',\n",
       "  'South Asia',\n",
       "  'Middle East & North Africa',\n",
       "  'America',\n",
       "  'Europe & Central Asia',\n",
       "  'East Asia & Pacific'])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "process_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1199\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1199\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1199\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1199\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1199\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure,output_notebook,show\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"59a5a948-6247-4c54-b1d3-2991842e2970\" data-root-id=\"1448\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"539fe87d-20ca-4816-ae4b-897e20930676\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1459\"}],\"center\":[{\"id\":\"1462\"},{\"id\":\"1466\"},{\"id\":\"1494\"}],\"left\":[{\"id\":\"1463\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"1484\"}],\"title\":{\"id\":\"1449\"},\"toolbar\":{\"id\":\"1474\"},\"x_range\":{\"id\":\"1451\"},\"x_scale\":{\"id\":\"1455\"},\"y_range\":{\"id\":\"1453\"},\"y_scale\":{\"id\":\"1457\"}},\"id\":\"1448\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1492\",\"type\":\"Selection\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"1484\"}]},\"id\":\"1495\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis\":{\"id\":\"1459\"},\"ticker\":null},\"id\":\"1462\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1455\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"1481\"}},\"id\":\"1485\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1467\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1471\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1453\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1464\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1470\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"1487\"},\"ticker\":{\"id\":\"1464\"}},\"id\":\"1463\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1487\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"1489\"},\"ticker\":{\"id\":\"1460\"}},\"id\":\"1459\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1482\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1468\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1473\"}},\"id\":\"1469\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1451\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"1481\"},\"glyph\":{\"id\":\"1482\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1483\"},\"selection_glyph\":null,\"view\":{\"id\":\"1485\"}},\"id\":\"1484\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"text\":\"line example\"},\"id\":\"1449\",\"type\":\"Title\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1473\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1467\"},{\"id\":\"1468\"},{\"id\":\"1469\"},{\"id\":\"1470\"},{\"id\":\"1471\"},{\"id\":\"1472\"}]},\"id\":\"1474\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1457\",\"type\":\"LinearScale\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5,6,7],\"y\":[5,7,1,4,5,10,5]},\"selected\":{\"id\":\"1492\"},\"selection_policy\":{\"id\":\"1493\"}},\"id\":\"1481\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis\":{\"id\":\"1463\"},\"dimension\":1,\"ticker\":null},\"id\":\"1466\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1472\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1493\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"items\":[{\"id\":\"1495\"}]},\"id\":\"1494\",\"type\":\"Legend\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1483\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1489\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1460\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"1448\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"539fe87d-20ca-4816-ae4b-897e20930676\",\"root_ids\":[\"1448\"],\"roots\":{\"1448\":\"59a5a948-6247-4c54-b1d3-2991842e2970\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1448"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 折线图\n",
    "x = [1, 2, 3, 4, 5, 6, 7]\n",
    "y = [5, 7, 1, 4, 5, 10,5]\n",
    "p = figure(title=\"line example\", x_axis_label='x', y_axis_label='y', width=400, height=400)\n",
    "p.line(x, y, legend=\"Temp.\", line_width=2)  # 折线\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
